package com.fourthGroup.service.impl;

import com.fourthGroup.model.Product;
import com.fourthGroup.model.User;
import com.fourthGroup.service.ProductService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class ProductServiceImpl implements ProductService {

    private Map<Integer, Product> productData;

    public ProductServiceImpl() {
        productData = new HashMap<>();
        Product product1 = new Product(1, "东北雨姐大粉条", 19.9, 10);
        Product product2 = new Product(2, "花东子粉底", 78.8, 10);
        Product product3 = new Product(3, "澳大利亚鹅羽绒服", 2000.0, 10);
        productData.put(product1.getPid(), product1);
        productData.put(product2.getPid(), product2);
        productData.put(product3.getPid(), product3);
    }


    @Override
    public Product queryProductById(Integer pid) {
        return productData.get(pid);
    }
}
